//Dao层数据库操作接口
package com.sy.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.sy.util.PageBean;
import com.sy.util.PageInfo;

@SuppressWarnings("unchecked")
public interface BaseDao {

//保存与更新
	@SuppressWarnings("unchecked")
	public void saveOrUpdateAll(List list);
	public void saveOrUpdateObject(Object o);
	public void addObject(Object o);

//获取对象

	public Object getObject(Class clazz, Serializable id);
	public List<Object> getObjects(Class clazz);
	public List<Object> getObjectsByExample(Object o);

//删除对象
	public void removeObject(Class clazz, Serializable id);

//获取查询列表
	public List find(String hql, Object[] objs);
	public List find(String hql);
	public List find(String hql, Object obj);

//动态查询（hibernate3的新增方法）
	public List findByCriteria(final DetachedCriteria detachedCriteria,
			final int FirstResult, final int MaxResults);
//获取总条数
	public int getCountByCriteria(final DetachedCriteria detachedCriteria);

//动态查找分页
	public List findByPage(final DetachedCriteria detachedCriteria,
			PageInfo pageinfo);

//按HQL查找
	public List findWithPages(final String hqlString, final PageInfo pageInfo)
			throws Exception;
	
//细化搜索
	public List findWithPagesByParamsWithOrderby(final String hqlString,
			final Object[] objs, final PageInfo pageInfo, final String field);

//搜索
	public List findWithPagesByParams(final String hqlString,
			final Object[] objs, final PageInfo pageInfo);

//查询列表
	public List getAllRows(final String hqlString);

//获取分页总行数
	public int getAllRowsCount(String hqlString);

//分页实现
	public PageBean getPageBean(final DetachedCriteria dc,int pageNO,int pageSize);
	
//动态分页
	public List getList(DetachedCriteria dc,int pageNO,int pageSize);
}